<template>

	<!-- <zhuce v-if="showz" @getisShowClock='getisShowClock' :isShowClock="isShowClock"
		@doZhuce="doZhuce" :phonePwd="phonePwd"></zhuce>

	<findback v-else-if="showf" @getisShowClock='getisShowClock' :isShowClock="isShowClock"
		@doZhuce="doZhuce" :phonePwd="phonePwd"></findback>

	<phonelogin v-else-if="showp" @getisShowClock='getisShowClock' :isShowClock="isShowClock"
		@doZhuce="doZhuce" :phonePwd="phonePwd"></phonelogin> -->

	<wx v-if="showv"  @getisShowClock='getisShowClock' :isShowClock="isShowClock"
		:openid="openid" @doZhuce="doZhuce" :phonePwd="phonePwd"></wx>

</template>

<script>
	//import zhuce from '../../components/zhuce/component_zhuce.vue'
	//import findback from '../../components/zhuce/component_findback.vue'
	//import phonelogin from '../../components/zhuce/components_phonelogin.vue'
	//import wx from '../../components/zhuce/component_wx.vue'
	import doErro from '../../tools/doErro/index.js'
	import doMath from "../../tools/doMath/index.js"
	import canYouCommit from '../../tools/canYouCommit/index.js'
	const zhuCe = uniCloud.importObject('rc_zhuce');
	export default {
		data() {
			return {
				showz: false,
				showf: false,
				showp: false,
				showv: false,
				phonePwd: '',
				isShowClock: 0,
				avatarUrl: '',
				commitContral: false,
				openid: ""
			};
		},
		methods: {
			//完成注册
			doZhuce(parms) {
				if (canYouCommit.doCommit(parms)) {
					uni.showLoading({
						title: "正在注册",
						mask: true
					})
					let res = zhuCe.doZhuCe(parms, Date.parse(new Date()));
					res.then((data) => {
						if (data.errcode) {
							uni.hideLoading();
							doErro.showErro(data.errcode);
						} else if (parms.componentName == "wx") {
							uni.hideLoading();
							uni.showModal({
								content: "今后用微信或用户名均可登录",
								success(res) {
									if (res.confirm) {
										uni.redirectTo({
											url: "/pages/login/login"
										})
									}
								}
							});
						} else {
							uni.hideLoading();
							uni.showModal({
								content: "注册成功",
								success(res) {
									if (res.confirm) {
										uni.redirectTo({
											url: "/pages/login/login "
										})
									}
								}
							});
						}
					})
				}
			}
		},
		//通过参数决定显示哪个页面
		onLoad(option) {
			let title;
			if (option.method === 'z') {
				this.showz = true;
				title = '注册'
			} else if (option.method === 'f') {
				this.showf = true;
				title = '找回密码'
			} else if (option.method === 'p') {
				this.showp = true;
				title = "登录"
			} else if (option.method === 'wx') {
				this.showv = true;
				title = "微信登录";
				this.openid = option.openid;
			}
			uni.setNavigationBarTitle({
				title: title
			});
		}
	}
</script>

<style lang="scss" scoped>

</style>